Assignemnt #70 and 68th program

Code

///Name: Derrick Andreasen
///Period: 7
///Program name: 68th Program
///File name: Sixt8Prog.java
///Date Finished:12/1/2015

import java.util.Random;
import java.util.Scanner;

public class Sixt8Prog
{
	public static void main( String[] args )
    {
    Random rng = new Random();
    Scanner keyboard = new Scanner(System.in);
        
    String again;
    
    int flip = rng.nextInt(2);
            String coin;
        
        
           do
           {
            if ( flip == 1 )
                coin = "HEADS";
            else
                coin = "TAILS";
            System.out.println( "You flip a coin and it is... " + coin );
        
            System.out.print( "Would you like to flip again (y/n)? " );
            again = keyboard.next();
        
    }while ( again.equals("y") );
       
    }
}

// if what was added in step one was deleted then the program would not function because the string again wouldnt be initialized.

Picture of the output

Assignment 70